<template>
    <view class="control_box">
        <view class="cart_decrease" @touchstart.stop="AddShoppingList(2)">
            <image
                class="icon"
                :src="
                    props.num == 1
                        ? getImgOssUrl('/ui-prod-2.0.0/reduce.png')
                        : getImgOssUrl('/ui-prod-2.0.0/black_1.2.png')
                " />
        </view>
        <view class="cart_quantity" @touchstart.stop> {{ props.num }} </view>
        <view class="cart_add cart_right" @touchstart.stop="AddShoppingList(1)">
            <image
                class="icon"
                v-if="props.islimit"
                :src="
                    props.num < props.maxQuantity
                        ? getImgOssUrl('/ui-prod-2.0.0/add_1.1.png')
                        : getImgOssUrl('/ui-prod-2.0.0/add_1.2.png')
                " />
            <image class="icon" v-else :src="getImgOssUrl('/ui-prod-2.0.0/add_1.1.png')" />
        </view>
    </view>
</template>
<script setup>
import { getImgOssUrl } from '@/commons/utils.js';
const emit = defineEmits(['AddShoppingList']);
const props = defineProps({
    num: {
        type: Number,
        default: 1
    },
    maxQuantity: {
        type: Number,
        default: 1
    },
    islimit: {
        type: Boolean,
        default: true
    }
});
const AddShoppingList = type => {
    emit('AddShoppingList', type);
};
</script>
<style lang="scss" scoped src="./index.scss"></style>
